using System.Data;
using ET;
namespace DAL
{
    public class Import_Detail_DAL
    {
        private readonly clsConnect cls = new clsConnect();

        #region Getdata
        public DataTable BindGirdtb_Import_Detail(string keywords)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@KeyWords", keywords);
            return cls.GetData("sp_tb_Import_Detail_Search");
        }
        public DataTable BindGirdtb_Import_Materials(int id)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Import_ID", id);
            return cls.GetData("sp_tb_Import_Detail_Proposed");
        }
        public DataTable BindGirdtb_Import_Materials_Edit(int id)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Import_ID", id);
            return cls.GetData("sp_tb_Import_Detail_Proposed_Edit");
        }

        #endregion

        #region Insert
        public bool Inserttb_Import_Detail(Import_Detail_ET data)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Import_ID", data.Import_ID);
            cls.AddParameter("@Materials_ID", data.Materials_ID);
            cls.AddParameter("@Import_Detail_Quality_Voucher", data.Import_Detail_Quality_Voucher);
            cls.AddParameter("@Import_Detail_Quality_HaveImport", data.Import_Detail_Quality_HaveImport);
            cls.AddParameter("@Import_Detail_Quality", data.Import_Detail_Quality);
            cls.AddParameter("@Import_Detail_Price", data.Import_Detail_Price);
            return cls.ExecuteNonQuery("sp_tb_Import_Detail_Insert");
        }
        #endregion

        #region Update
        public bool Updatetb_Import_Detail(Import_Detail_ET data)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Import_Detail_ID", data.Import_Detail_ID);
            cls.AddParameter("@Import_ID", data.Import_ID);
            cls.AddParameter("@Materials_ID", data.Materials_ID);
            cls.AddParameter("@Import_Detail_Quality_Voucher", data.Import_Detail_Quality_Voucher);
            cls.AddParameter("@Import_Detail_Quality_HaveImport", data.Import_Detail_Quality_HaveImport);
            cls.AddParameter("@Import_Detail_Quality", data.Import_Detail_Quality);
            cls.AddParameter("@Import_Detail_Price", data.Import_Detail_Price);
            return cls.ExecuteNonQuery("sp_tb_Import_Detail_Update");
        }
        #endregion

        #region Delete
        public bool Deletetb_Import_Detail(int id)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Import_Detail_ID", id);
            return cls.ExecuteNonQuery("sp_tb_Import_Detail_Delete");
        }
        public bool Deletetb_Import_Detail_Default_ID(int id)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Import_ID", id);
            return cls.ExecuteNonQuery("sp_tb_Import_Detail_Delete_Default");
        }
        #endregion

        #region Sum
        public DataTable Sum_Import_Detail_Quality_HaveImport(int id)
        {
            cls.CreateNewSqlCommand();
            cls.AddParameter("@Material_ID", id);
            return cls.GetData("sp_tb_Import_Detail_Sum_Quality_HaveImport");
        }
        #endregion
    }
}